#Morse-Code-Package
#Version 1.0
"""
这是一个官方煤油de东西！！！这个包做的是关于摩斯密码的加密与解码，让你透心凉（bushi）。
这个包会发布到Gitee上，请查收~
你可能会发现一些彩蛋。
"""
def encode(string="Genshin-Impact"):
    ins = string
    tm = ""
    for r in range(len(ins)):
        g = ""
        if ins[r] == "0":
            g = "-----"
        elif ins[r] == "1":
            g = ".----"
        elif ins[r] == "2":
            g = "..---"
        elif ins[r] == "3":
            g = "...--"
        elif ins[r] == "4":
            g = "....-"
        elif ins[r] == "5":
            g = "....."
        elif ins[r] == "6":
            g = "-...."
        elif ins[r] == "7":
            g = "--..."
        elif ins[r] == "8":
            g = "---.."
        elif ins[r] == "9":
            g = "----."
        elif ins[r] == "A" or ins[r] == "a":
            g = ".-"
        elif ins[r] == "B" or ins[r] == "b":
            g = "-..."
        elif ins[r] == "C" or ins[r] == "c":
            g = "-.-."
        elif ins[r] == "D" or ins[r] == "d":
            g = "-.."
        elif ins[r] == "E" or ins[r] == "e":
            g = "."
        elif ins[r] == "F" or ins[r] == "f":
            g = "..-."
        elif ins[r] == "G" or ins[r] == "g":
            g = "--."
        elif ins[r] == "H" or ins[r] == "h":
            g = "...."
        elif ins[r] == "I" or ins[r] == "i":
            g = ".."
        elif ins[r] == "J" or ins[r] == "j":
            g = ".---"
        elif ins[r] == "K" or ins[r] == "k":
            g = "-.-"
        elif ins[r] == "L" or ins[r] == "l":
            g = ".-.."
        elif ins[r] == "M" or ins[r] == "m":
            g = "--"
        elif ins[r] == "N" or ins[r] == "n":
            g = "-."
        elif ins[r] == "O" or ins[r] == "o":
            g = "---"
        elif ins[r] == "P" or ins[r] == "p":
            g = ".--."
        elif ins[r] == "Q" or ins[r] == "q":
            g == "--.-"
        elif ins[r] == "R" or ins[r] == "r":
            g = ".-."
        elif ins[r] == "S" or ins[r] == "s":
            g = "..."
        elif ins[r] == "T" or ins[r] == "t":
            g = "-"
        elif ins[r] == "U" or ins[r] == "u":
            g = "..-"
        elif ins[r] == "V" or ins[r] == "v":
            g = "...-"
        elif ins[r] == "W" or ins[r] == "w":
            g = ".--"
        elif ins[r] == "X" or ins[r] == "x":
            g = "-..-"
        elif ins[r] == "Y" or ins[r] == "y":
            g = "-.--"
        elif ins[r] == "Z" or ins[r] == "z":
            g = "--.."
        elif ins[r] == ".":
            g = ".-.-.-"
        elif ins[r] == ":":
            g = "---..."
        elif ins[r] == ",":
            g = "--..--"
        elif ins[r] == ";":
            g = "-.-.-."
        elif ins[r] == "?":
            g = "..--.."
        elif ins[r] == "=":
            g = "-...-"
        elif ins[r] == "'":
            g = ".----."
        elif ins[r] == "/":
            g = "-..-."
        elif ins[r] == "!":
            g = "-.-.--"
        elif ins[r] == "-":
            g = "-....-"
        elif ins[r] == "_":
            g = "..--.-"
        elif ins[r] == '"':
            g = ".-..-."
        elif ins[r] == "(":
            g = "-.--."
        elif ins[r] == ")":
            g = "-.--.-"
        elif ins[r] == "$":
            g = "...-..-"
        elif ins[r] == "&":
            g = "...."
        elif ins[r] == "@":
            g = ".--.-."
        else:
            raise NameError("字符串里输入了一些中文或不能转换的符号")
        tm = tm + "/" + g
    return tm
def decode(string="/--././-./.../..../../-./-....-/../--/.--./.-/-.-./-"):
    x = string.split("/")
    del x[0]
    c = ""
    a = ""
    for f in range(len(x)):
        if x[f] == ".-":
            c = "A"
        elif x[f] == "-...":
            c = "B"
        elif x[f] == "-.-.":
            c = "C"
        elif x[f] == "-..":
            c = "D"
        elif x[f] == ".":
            c = "E"
        elif x[f] == "..-.":
            c = "F"
        elif x[f] == "--.":
            c = "G"
        elif x[f] == "....":
            c = "H"
        elif x[f] == "..":
            c = "I"
        elif x[f] == ".---":
            c = "J"
        elif x[f] == "-.-":
            c = "K"
        elif x[f] == ".-..":
            c = "L"
        elif x[f] == "--":
            c = "M"
        elif x[f] == "-.":
            c = "N"
        elif x[f] == "---":
            c = "O"
        elif x[f] == ".--.":
            c = "P"
        elif x[f] == "--.-":
            c = "Q"
        elif x[f] == ".-.":
            c = "R"
        elif x[f] == "...":
            c = "S"
        elif x[f] == "-":
            c = "T"
        elif x[f] == "..-":
            c = "U"
        elif x[f] == "...-":
            c = "V"
        elif x[f] == ".--":
            c = "W"
        elif x[f] == "-..-":
            c = "X"
        elif x[f] == "-.--":
            c = "Y"
        elif x[f] == "--..":
            c = "Z"
        elif x[f] == "-----":
            c = "0"
        elif x[f] == ".----":
            c = "1"
        elif x[f] == "..---":
            c = "2"
        elif x[f] == "...--":
            c = "3"
        elif x[f] == "....-":
            c = "4"
        elif x[f] == ".....":
            c = "5"
        elif x[f] == "-....":
            c = "6"
        elif x[f] == "--...":
            c = "7"
        elif x[f] == "---..":
            c = "8"
        elif x[f] == "----.":
            c = "9"
        elif x[f] == ".-.-.-":
            c = "."
        elif x[f] == "---...":
            c = ":"
        elif x[f] == "--..--":
            c = ","
        elif x[f] == "-.-.-.":
            c = ";"
        elif x[f] == "..--..":
            c = "?"
        elif x[f] == "-...-":
            c = "="
        elif x[f] == ".----.":
            c = "'"
        elif x[f] == "-..-.":
            c = "/"
        elif x[f] == "-.-.--":
            c = "!"
        elif x[f] == "-....-":
            c = "-"
        elif x[f] == "..--.-":
            c = "_"
        elif x[f] == ".-..-.":
            c = '"'
        elif x[f] == "-.--.":
            c = "("
        elif x[f] == "-.--.-":
            c = ")"
        elif x[f] == "$":
            c = "...-..-"
        elif x[f] == "@":
            c = ".--.-."
        else:
            raise NameError("此摩斯密码不可解开")
        a = a + c
    return a
def version():
    print("Morse Code Package 1.0")
    print("由Selighx-Xetroz制作")